﻿using Shop.RemoteModel.Stock;
using Shop.RemoteModel.Stock.Model;
using Shop.StoreGatewayModular.Interface;
using Shop.StoreGatewayModular.Model.Stock;
using WeDonekRpc.Client;
using WeDonekRpc.HttpApiGateway.Model;

namespace Shop.StoreGatewayModular.Service
{
    internal class StockService : IStockService
    {
        public int GetStockNum (long skuId)
        {
            return new GetSkuStockNum
            {
                SkuId = skuId,
            }.Send();
        }
        public PagingResult<GoodsStockDto> Query (PagingParam<StockQueryParam> query)
        {
            return new QueryGoodsStock
            {
                Index = query.Index,
                IsDesc = query.IsDesc,
                Size = query.Size,
                SortName = query.SortName,
                NextId = query.NextId,
                Query = query.Query
            }.Send();
        }
        public bool AddSkuStock (StockAdd add, long userId)
        {
            return new AddSkuStock
            {
                Data = new SkuStockAdd
                {
                    SkuId = add.SkuId,
                    Stock = add.Stock,
                    UserId = userId
                }
            }.Send();
        }

    }
}
